import {
	IEditFormAbility,
	IWFDynaEditViewAbility,
	IWFDynaEditViewController,
	IWFDynaEditViewModel,
	IWFDynaEditViewStore,
	WFDynaEditViewActionType,
} from '@/core/interface';
import { WFEditViewController } from './wf-edit-view-controller';

/**
 * 工作流动态编辑视图
 *
 * @export
 * @class WFDynaEditViewController
 * @extends {DEViewController<WFDynaEditViewActionType, IWFDynaEditViewStore, IWFDynaEditViewAbility>}
 * @implements {IWFDynaEditViewController<IWFDynaEditViewStore, IWFDynaEditViewAbility>}
 */
export class WFDynaEditViewController
	extends WFEditViewController<
		WFDynaEditViewActionType,
		IWFDynaEditViewStore,
		IWFDynaEditViewAbility
	>
	implements
		IWFDynaEditViewController<IWFDynaEditViewStore, IWFDynaEditViewAbility>
{
	/**
	 * 工作流动态编辑视图模型
	 *
	 * @protected
	 * @type {IWFDynaEditViewModel}
	 * @memberof WFDynaEditViewController
	 */
	protected declare readonly model: IWFDynaEditViewModel;

	/**
	 * 获取表单能力
	 *
	 * @protected
	 * @return {*}  {(IEditFormAbility | undefined)}
	 * @memberof WFDynaEditViewController
	 */
	protected getMainCtrlAbility(): IEditFormAbility | undefined {
		if (this.store.activeForm) {
			return this.getSubAbility<IEditFormAbility>(this.store.activeForm.name);
		}
		return undefined;
	}
}
